<template>
  <el-form-item
    :label="label"
    :label-width="labelWidth"
    :prop="props.data.field"
    :required="props.data.required"
    :rules="props.data.rules"
  >
    <el-time-picker
      v-model="val"
      :style="{ width: `${props.data.compWidth || 100}%` }"
      is-range
      clearable
      range-separator="至"
      value-format="HH:mm:ss"
      :start-placeholder="props.data.bPlaceholder"
      :end-placeholder="props.data.ePlaceholder"
      :readonly="props.data.readonly"
      :disabled="props.data.disabled"
    />
  </el-form-item>
</template>

<script setup lang="ts">
import { ElFormItem, ElTimePicker } from 'element-plus'
import { useProps, useValue } from '../../common-props/hooks'

const props = defineProps<{ data: Record<string, any>; form: Record<string, any> }>()
const emits = defineEmits(['valueChange'])

const { label, labelWidth } = useProps(props)
const { val } = useValue(props, emits)
</script>

<style lang="scss" scoped></style>
